package com.yourbatis.syntax;

import com.yourbatis.interpreter.Environment;

import java.util.List;

public class FunStatement implements Statement{

    private final String name;
    private final List<String> parameters;
    private final BlockStatement body;

    public FunStatement(String name, List<String> parameters, BlockStatement body) {
        this.name = name;
        this.parameters = parameters;
        this.body = body;
    }

    @Override
    public Object execute() {
        Environment.defineFun(name, new FunctionObject(parameters, body));
        return null;
    }
}
